package com.kzc.dao;

import com.kzc.core.MyBatisDao;
import com.kzc.entity.Article;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * Author：柯尊诚
 * Created by anyleKe on 2016/2/25.
 */
@MyBatisDao
public interface CollectionDao {

    @Options(useGeneratedKeys=true, keyProperty="id")
    @Insert("insert into t_collection(title, editorAuthor, image, content, sysId, releaseDate, qtoken) " +
            "values(#{title}, #{editorAuthor}, #{image}, #{content}, #{sysId}, #{releaseDate}, #{qtoken})")
    int add(Article article);

    @Select("select * from t_collection where qtoken=#{qtoken}")
    List<Article> queryCollection(@Param("qtoken") String qtoken);

    @Delete("delete from t_collection where sysId=#{sysId} and qtoken=#{qtoken}")
    int delete(@Param("sysId")String sysId, @Param("qtoken")String qtoken);
}
